package com.rd.student.jiaji.class4.suyan;

import java.util.ArrayList;
import java.util.LinkedList;

public class LinkedListTest {
    public static void main(String[] args) {
        LinkedList list=new LinkedList();
        Student s=new Student("苏岩","21-4","中加计算机",20);
        Student s1=new Student("石睿","21-2","中加计算机",21);
        Student s2=new Student("李鑫","21-1","中加计算机",23);
        Student s3=new Student("黄一鸣","21-2","中加计算机",22);
        Student s4=new Student("杜雨坤","21-1","中加计算机",21);
        Student s5=new Student("王宇芳","21-1","中加计算机",20
        );
        s.showinfo();
        s1.showinfo();
        s2.showinfo();
        s3.showinfo();
        s4.showinfo();
        s5.showinfo();
        list.add(s);
        list.add(s1);
        list.add(s2);
        list.add(s3);
        list.add(s4);
        list.add(s5);


    }
    //根据你班级返回list
    public static LinkedList asclass(String banji,LinkedList list){
       LinkedList list1=new LinkedList();
       for (int i=0;i<list.size();i++){
           Group_Num s=(Group_Num) (list.get(i));//获取这个元素
           if (s.getBanji()==banji){
               list1.add(list.get(i));
           }
       }
        return list1;
    }
    //根据专业返回list
    public static LinkedList asMajor(String major,LinkedList list){
        LinkedList list2=new LinkedList();
        for (int i=0;i<list.size();i++){
            Group_Num s=(Group_Num) (list.get(i));
            if (s.getMajor()==major){
                list2.add(list.get(i));
            }
        }
        return list2;
    }//根据年龄返回age
    public  static LinkedList asAge(int age ,LinkedList list){
        LinkedList list3=new LinkedList();
        for (int i=0;i<list.size();i++){
            Group_Num s=(Group_Num)(list.get(i));
            if (s.getAge()==age){
                list3.add(list.get(i));
            }
        }
        return list3;
    }
    //成员名字汇总
    public static  LinkedList getAllNum(LinkedList list){
        LinkedList list4=new LinkedList();
        for (int i=0;i<list.size();i++);{

        }
        return list4;
    }


}
class Group_Num{
    private String name;
    private String major;
    private String banji;
    private  int age;
    private String description;

    public Group_Num() {
    }

    public Group_Num(String name, String major, String banji, int age, String description) {
        this.name = name;
        this.major = major;
        this.banji = banji;
        this.age = age;
        this.description = description;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public String getBanji() {
        return banji;
    }

    public void setBanji(String banji) {
        this.banji = banji;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
    @Override
    public String toString(){
        return "姓名"+name+" "+
                "专业"+major+" "+
                "班级"+banji+""+"年龄"+age+"描述"+description;
    }
}
